Ho Chi Minh birth data

# load libraries
library(tidyverse)
library(plotly)
library(rlang)
library(downloadthis)
source("helpers.R")

Download birth data

List of variables
Variable Description
birth_week week of birth (within a birth_year), value rangess from 1-53
birth_year year of birth
province_reg registered province (residential address, only include “Hồ Chí Minh city”)
district_reg registered district (residential address)
commune_reg registered province (residential address)
n number of births
cumulative_week computed cumulative week for years after 2014

</details>

Plot number of newborns overtime

plot_data <- compute_birth(birth_data, concatenate_by = "yearly")
`summarise()` has grouped output by 'birth_year'. You can override using the
`.groups` argument.
ggplotly(
  plot_data$plot
)
# compute birth at yearly, district level
plot_data <- compute_birth(birth_data)
`summarise()` has grouped output by 'cumulative_week'. You can override using
the `.groups` argument.
ggplotly(
  plot_data$plot
)

Plot number of births by year

Check if there is any trend in the number of births within each year

ggplotly(
  ggplot()+
  geom_line(
    aes(x = birth_week, y = no_birth),
    color="royalblue1",
    data = birth_data %>% group_by(birth_week) %>% summarize(no_birth = sum(n))
  )
)
# --- compute total birth by month ---- 
ggplotly(
  ggplot()+
  geom_line(
    aes(x = birth_week, y = no_birth, color = factor(birth_year) ),
    data = birth_data %>% group_by(birth_week, birth_year) %>% summarize(no_birth = sum(n))
  )
)
`summarise()` has grouped output by 'birth_week'. You can override using the
`.groups` argument.